const mongoose = require("mongoose");
//1.连接本地数据库
mongoose.connect( 'mongodb://127.0.0.1:27017/movies', {useNewUrlParser: true});
//2.在本地定义一个Schema和远程数据库的字段映射
var Top250Schema = new mongoose.Schema({
    name:String,
    rating:Number
});
// 3.创建数据模型，操作数据库
var Top250Model = mongoose.model("top250",Top250Schema);  //是我们获取的数据库里Top250的那张表
module.exports = Top250Model;